<template>
<div class="" id="projectLoad">
    <div class="pr10">
        <div class="analyItem">
            <p class="analyItemTit tx-center">状态</p>
            <div class="analyItemCon">

            </div>
        </div>
    </div>
    <div class="thinScroll pr10" v-scrollHeight="10" v-html="loadData" id="loadData"></div>
</div>
</template>
<script>
import rxQrcode from '@rx/packages/qrcode/Index'
import { mapGetters } from 'vuex'
export default {
    data () {
        return {
            pullIndex: undefined,
            loadData: '',
            imgList: [], // 图片数组
            link: '' // 链接
        }
    },
    computed: {
        ...mapGetters(['leftInfo', 'userInfo'])
    },
    created () {
        if (this.leftInfo.orderno) {
            this.getLoad(this.leftInfo.orderno)
        }
    },
    mounted () {},
    components: {
        rxQrcode
    },
    methods: {
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        },
        getLoad (orderno) {
            this.$axios.get('https://gams.rxjy.com/a/ams/workorder/API/GetProjectModule?orderno=' + orderno + '&postType=12').then((result) => {
                this.loadData = result.data
                this.$nextTick(() => {
                    const loadDom = document.querySelector('#loadData')
                    loadDom.addEventListener('click', (e) => {
                        this.imgList = []
                        const currentEle = $(e.target).parents('a')
                        if (currentEle && currentEle.attr('img')) {
                            const currentImg = currentEle.attr('img').split(';')
                            currentImg.forEach(item => {
                                if (!item.startsWith('https')) {
                                    // 判断是否以https开头的
                                    let img = item.split('!')[1].split('#')
                                    this.imgList.push(img[0])
                                    this.$router.push({path: '/projectFiles/Project/projectThree', query: {data: this.imgList, flag: 1}})
                                } else {
                                    this.link = currentImg[0]
                                    this.$router.push({path: '/projectFiles/Project/projectThree', query: {data: this.link, flag: 2}})
                                }
                            })
                        }
                    })
                })
            })
        }
    },
    watch: {
        leftInfo () {
            this.getLoad(this.leftInfo.orderno)
        }
    }
}
</script>
